#include "singleton.h"

static singleton* m_instance = nullptr;
static std::once_flag m_flag;

singleton *singleton::instance()
{
    std::call_once(&m_flag, [&]{
        m_instance = new singleton();
        atexit(destruct); // 析构
    })

    return m_instance;
}